Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types.mdx): add hint for difference of tuples and lists #35957

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

corsin-ragettli
Copy link

This PR adds a section to the Types list of the terraform docs. On this page, it wasn't explained on how lists and tuples differ. As seen in the documentation of the tolist function, they do clearly have a difference.

1.10.x

Draft CHANGELOG entry

ENHANCEMENTS

  • Added the differences between tuples and lists to the Types documentation

Copy link

hashicorp-cla-app bot commented Nov 6, 2024

CLA assistant check
All committers have signed the CLA.

Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

@@ -80,6 +80,9 @@ List literals can be split into multiple lines for readability, but always
require a comma between values. A comma after the final value is allowed,
but not required. Values in a list can be arbitrary expressions.

Tuples do allow elements to have mixed data types, like `["a", 15, true]`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps better to link to the "Type Constraints" page which describes the types in more detail, or at least use the same verbiage to keep things consistent in the documentation.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for your comment. I opted to directly link the Type Constraints page. Please let me know if I should change the wording

@crw crw added the waiting-response An issue/pull request is waiting for a response from the community label Nov 19, 2024
@corsin-ragettli corsin-ragettli requested review from a team as code owners November 21, 2024 09:32
Copy link
Contributor

@rkoron007 rkoron007 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good with a small style suggestion! ✨

@@ -80,6 +80,8 @@ List literals can be split into multiple lines for readability, but always
require a comma between values. A comma after the final value is allowed,
but not required. Values in a list can be arbitrary expressions.

List and tuples have differences regarding allowed types. See [tuples](/terraform/language/expressions/type-constraints#tuple) and [lists](/terraform/language/expressions/type-constraints#list)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried expanding on this a bit for clarity:

Suggested change
List and tuples have differences regarding allowed types. See [tuples](/terraform/language/expressions/type-constraints#tuple) and [lists](/terraform/language/expressions/type-constraints#list)
Lists and tuples each have different constraints on the types they allow. For more information on the types that each allows, refer to [tuples](/terraform/language/expressions/type-constraints#tuple) and [lists](/terraform/language/expressions/type-constraints#list).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation waiting-response An issue/pull request is waiting for a response from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants